<?php

class user_detail extends a_admin_controller {

    protected $user_obj;
    protected $user_billing_address;
    protected $user_shipping_address_list;
    protected $srv;

    public function __construct() {
        parent::__construct(true);

        $this->srv = new user_service_l_user();

    }

    public function batch_assign(){

        $this->assign("user_obj", $this->user_obj ? $this->user_obj : NULL);
        $this->assign("user_billing_address", $this->user_billing_address);
        $this->assign("user_shipping_address_list", $this->user_shipping_address_list);
    }

    public function index()
    {
    }

    public function load_user_details($user_id=NULL)
    {
        $user_id = $user_id==NULL ?  $user_id=$this->input->post('id') : $user_id;

        //get his name, username and email
        $this->user_obj = get_object($user_id, "user_m_user");
        $this->assign("user_obj", $this->user_obj ? $this->user_obj->convert_to_simple_data() : NULL);

        //get his shipping address list
        $this->user_shipping_address_list = $this->srv->get_shipping_addresses($user_id);
        
        //get his billing address
        $this->user_billing_address = $this->srv->get_billing_address($user_id);
    }

}

?>

